package me.ctidy.assignment04.activity;

import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import me.ctidy.assignment04.R;

public class MainActivity extends AppCompatActivity {

    private TextView tvWelcome;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initUI();
    }

    private void initUI() {
        // I. 绑定控件
        tvWelcome = findViewById(R.id.am_tv_welcome);

        // II. 渲染数据 (动态更新控件)
        String username = getIntent().getExtras().getString("username", "");
        tvWelcome.setText(String.format(
                getText(R.string.am_tv_welcome_text).toString(),
                username
        ));
    }

}
